package Thread_2;

public class Thread_2 {
    public static void main1(String[] args) throws InterruptedException {
        T t = new T();
        Thread t1 = new Thread(t);
        for (int i = 1; i <= 5; i++) {
            Thread.sleep(1000);
            System.out.println("hi"+i);
            //if(i==5){
                //t.join();
                //Thread.yield();
                //t1.start();
                //t1.join();
            }
        }
    }
//}
class T implements Runnable{
    @Override
    public void run() {
        for (int i = 1; i <= 10; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("hello"+i);
        }
    }
}
